UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FasJUZr4Rw+uaso+kZf5rmDdkN9RyW27eN/ITmaAAj8=' 
WHERE 
  key_id = '29d31f1e25b97b72394132d01aca62946c44b19040b879bca52efd6b4d8729c2' 
  AND (
    token = 'FasJUZr4Rw+uaso+kZf5rmDdkN9RyW27eN/ITmaAAj8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037