UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RrhzLNAO3XnLE88hy/lturQ795vy56TZIxJXRjUlKPQ=' 
WHERE 
  key_id = '64289ab58c7a66a6246b7213cf6bbad80994ba50c9b5ec1456740ce14a998e07' 
  AND (
    token = 'RrhzLNAO3XnLE88hy/lturQ795vy56TZIxJXRjUlKPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027