UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sFMyzvTmr8BKfGKkoEyXZzfoVC32WaVCzVNEWeWkdcs=' 
WHERE 
  key_id = '4ace9d931b4d339975f9bec0fbbe805fed29eeaef3faf941b6e7a7b58be8c978' 
  AND (
    token = 'sFMyzvTmr8BKfGKkoEyXZzfoVC32WaVCzVNEWeWkdcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022