UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H+esImn/D8CjsoCpiCDozgEK4gctD3sdQ//IDyazKFQ=' 
WHERE 
  key_id = 'd96ce29a0af62655417785f89b03df167db1fbf4d09386177c9e7a1d021b58f4' 
  AND (
    token = 'H+esImn/D8CjsoCpiCDozgEK4gctD3sdQ//IDyazKFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044