UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tHyrKQqja/Zmw/9gIz+lQiSkBrZqD4sOmz/QC0XU5uQ=' 
WHERE 
  key_id = '71377ae68c79f6af288c215fef96c3c139f21343dc611cdf807ad14c24240148' 
  AND (
    token = 'tHyrKQqja/Zmw/9gIz+lQiSkBrZqD4sOmz/QC0XU5uQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020