UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kDzKvBzUFts/B/W9abrtv5FTwupFyQloS9YgQcvMvyo=' 
WHERE 
  key_id = 'c5351c98ca6aa94700ffbdfd39c0512179faf6924131d3f6c5c23484e903af15' 
  AND (
    token = 'kDzKvBzUFts/B/W9abrtv5FTwupFyQloS9YgQcvMvyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039