UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tACuyxWfPhiTX3gCAKo0vi7QjcEfxTXdtw+hJA51yN0=' 
WHERE 
  key_id = '968a48abea159c93ca5254423e536ec925ed5563bd4398d4c7994e687dd57118' 
  AND (
    token = 'tACuyxWfPhiTX3gCAKo0vi7QjcEfxTXdtw+hJA51yN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038