UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'miDvAZjBCLtJoOcRlkVEuwdccfM1m+NhTX5irbMUFDg=' 
WHERE 
  key_id = 'c780b6c196ceea4a10df492e40e0fcb4338cee4be1a1c4dc87b2f8f6e7fb056d' 
  AND (
    token = 'miDvAZjBCLtJoOcRlkVEuwdccfM1m+NhTX5irbMUFDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042