UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FCJsBFnGg+Zw6S8MPOpPO1imvrpAu8jNNd2OrfhSlj8=' 
WHERE 
  key_id = '0094b39565ce98862374aad9f00f620c431604d7aeaecbc6195949f83ea35b37' 
  AND (
    token = 'FCJsBFnGg+Zw6S8MPOpPO1imvrpAu8jNNd2OrfhSlj8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028