UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lekzOr3aFnSypKc9Y+hGn3Ms9uu7Nw9aSDqQOdrN2XQ=' 
WHERE 
  key_id = '94936604845af5aaad96e5495cf9748bf109abcee6bcf159f63876262beaffea' 
  AND (
    token = 'lekzOr3aFnSypKc9Y+hGn3Ms9uu7Nw9aSDqQOdrN2XQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050