UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i+TZ+UGeFuJGpy45J83W1G5lWpEzuzzwy829wDtLp44=' 
WHERE 
  key_id = '2324235d8810f9bc355c0331f4d234f074108865af080a697aaefdb68d8ab5b0' 
  AND (
    token = 'i+TZ+UGeFuJGpy45J83W1G5lWpEzuzzwy829wDtLp44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034