UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3Gozzo3fFxUpBo5bqtGMslAiBtKm3WLFIXweed8YZk=' 
WHERE 
  key_id = 'ba3ee4eff963475ed50143511949c42ab42995749146290a5f2bf8d6a6b8525c' 
  AND (
    token = 'q3Gozzo3fFxUpBo5bqtGMslAiBtKm3WLFIXweed8YZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024