UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wNt5iHRCE9F6MJMS4e289K09aotKgmklDvtTivc6w1s=' 
WHERE 
  key_id = '49c72789c8ccec791c2d9d0e5b731203911cad1079ba33038417af246c474431' 
  AND (
    token = 'wNt5iHRCE9F6MJMS4e289K09aotKgmklDvtTivc6w1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035