UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8G8i6EgCMPjAInaBUAcEjA3bmu6VREcwZJsEykwPLQ0=' 
WHERE 
  key_id = '58bdb9dec6a1f7f14bf5c86b195bcbef04d77f22b14829fbd97a6404d0b89c77' 
  AND (
    token = '8G8i6EgCMPjAInaBUAcEjA3bmu6VREcwZJsEykwPLQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012