UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f+Rk1jt9Dnx9gWPNOwiOBYOvCupVKQkmBePagefbYbY=' 
WHERE 
  key_id = '421da9627b50e1e248c42743f63abb063c9524d0030afc061dcd9048407d877f' 
  AND (
    token = 'f+Rk1jt9Dnx9gWPNOwiOBYOvCupVKQkmBePagefbYbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041