UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qrRcDBCjxKrnRbGPgOhzTzciJOyO7saIg0xyzKLOcWc=' 
WHERE 
  key_id = '1b403647ac9ec6c52179348826ecff9d74e46193a97127cc25ccd47d919c5913' 
  AND (
    token = 'qrRcDBCjxKrnRbGPgOhzTzciJOyO7saIg0xyzKLOcWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029