UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zQKxddM91XjhBfqHgS9msfGPOI3vxpWAuedjjnYFRCk=' 
WHERE 
  key_id = 'a171b259d8e5ce9e820ff0e0f862eeb08c5da513f9729cc4239c8eba23ff03ac' 
  AND (
    token = 'zQKxddM91XjhBfqHgS9msfGPOI3vxpWAuedjjnYFRCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045