UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HUbfYtWm+UuDYZ46ADbg9YdBD70VIV5aob3vpBo0diU=' 
WHERE 
  key_id = '5c8692bebb6b0482df08bfa767266290be55bfd0ebc21182ea96270532a32166' 
  AND (
    token = 'HUbfYtWm+UuDYZ46ADbg9YdBD70VIV5aob3vpBo0diU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034