UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TYMWpweZPw4oNkrv3bym25AwTnHtT7yRLswdjI4mkjk=' 
WHERE 
  key_id = '74bc990a8eaab3867477085e490fc931e39f5f3c60b876a4e4b1c5fd6cec5337' 
  AND (
    token = 'TYMWpweZPw4oNkrv3bym25AwTnHtT7yRLswdjI4mkjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034