UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ID6LUwRXKO2Y8UFfa3TJwYkWVW5eVlyAO4N6Rd68Zmc=' 
WHERE 
  key_id = '12889725b5e64ea6543c790773fdbdcd40b0b6495d3ec88ec89c9f0f220d2446' 
  AND (
    token = 'ID6LUwRXKO2Y8UFfa3TJwYkWVW5eVlyAO4N6Rd68Zmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019