UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HkpcpW9wW5PcBK56mdCoPlTP4bwPMTrMs2VsCN2m6eA=' 
WHERE 
  key_id = '74f4f02cf3200568d4a962c4cc3b3ae32c737344042c746874e3d2a51d0b98e0' 
  AND (
    token = 'HkpcpW9wW5PcBK56mdCoPlTP4bwPMTrMs2VsCN2m6eA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030