UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XGwh+b9YLRasj9df3/LO9AzT0Zm1RjESBIcEPFZbqFI=' 
WHERE 
  key_id = '5098f3db28236160a6c312448fa6b61d6347783b9a60c77a5867f81a3ea942d1' 
  AND (
    token = 'XGwh+b9YLRasj9df3/LO9AzT0Zm1RjESBIcEPFZbqFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037