UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nnspBiaCECbdWyZZzIeFrUsbydTVMQ+7jBcZA711pnY=' 
WHERE 
  key_id = '74b9afce172c0d30dc026effb9f939f9b257278149cdf0016d0bf3e587b6180b' 
  AND (
    token = 'nnspBiaCECbdWyZZzIeFrUsbydTVMQ+7jBcZA711pnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037