UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ijxMFYFUfEb7Ouwkx/PGGQEjriPq8gujTQuy6r+gn8=' 
WHERE 
  key_id = '9de2b8771c6d7e07fe12203a9666e7b255106357a985309685d4cb29caa22956' 
  AND (
    token = '8ijxMFYFUfEb7Ouwkx/PGGQEjriPq8gujTQuy6r+gn8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029