UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0KsiA2QwnjeFMxmxQPSTHZNsIFg1Aa6u76Q98UokoU=' 
WHERE 
  key_id = '8fc14857cfc12ef2b4e765f0f3c252366d48ebb9a231767956c0fd8f83f7eae4' 
  AND (
    token = 'a0KsiA2QwnjeFMxmxQPSTHZNsIFg1Aa6u76Q98UokoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025