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

Query time 0.00036