UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VvujahBHQqXy+H43KVuIGjeQVyIolzuEycYZOUhLYKA=' 
WHERE 
  key_id = 'f1a98f9ab7c2f4b7ef0d3e4fed51d3f373c6640d9159f02c6f0f7356e6f295b6' 
  AND (
    token = 'VvujahBHQqXy+H43KVuIGjeQVyIolzuEycYZOUhLYKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042