UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FpaYmzojJbilcAcgWap2p3db2NHB5phkklkSW7bGcF8=' 
WHERE 
  key_id = '529b3edf29273d03c0c9fdf4e202087936269f993c759fc03d81d5808ec17ce7' 
  AND (
    token = 'FpaYmzojJbilcAcgWap2p3db2NHB5phkklkSW7bGcF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029