UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8HLdVS5COnSw/j2DuirlyzcpbsYfmClzZx05YedmtxM=' 
WHERE 
  key_id = '8d62e3688c45d5698fa3fbef7ca83640e87269b49a8fc233fe0811cda63a0740' 
  AND (
    token = '8HLdVS5COnSw/j2DuirlyzcpbsYfmClzZx05YedmtxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028