UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fFjXD1tJjqLr4akkTc7SvR5O3SeYtZrhNwyzeWyuJAY=' 
WHERE 
  key_id = '51cb71470d931108088b8feebb8d18b8da2c53fd0185a311ad34381654cc9a68' 
  AND (
    token = 'fFjXD1tJjqLr4akkTc7SvR5O3SeYtZrhNwyzeWyuJAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027