UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yb9y8LheLKT/3jtu9/RprRF5BF6fzQfYgus+r6+B7uk=' 
WHERE 
  key_id = '53417d2cfda1ac6efe97fc7f8e8ef5e5e801c24e8cf942df2bb5260ff3765da6' 
  AND (
    token = 'Yb9y8LheLKT/3jtu9/RprRF5BF6fzQfYgus+r6+B7uk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046