UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IyRn15grJ5FJJssEO6HfIMlb5z+kdYrGO7pooYGZWFA=' 
WHERE 
  key_id = '5f419f8e1df652e53da86e136decc067a6520a49d491f473deedff160e7ac6f9' 
  AND (
    token = 'IyRn15grJ5FJJssEO6HfIMlb5z+kdYrGO7pooYGZWFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032