UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tNVlFHB1FB5+lC2ylrQyANL7RLzN29pA3znhArXMXwc=' 
WHERE 
  key_id = '68a180375350c66bce4d5515f5838765fc6c0744b0a787d248e1690e1bc0bac9' 
  AND (
    token = 'tNVlFHB1FB5+lC2ylrQyANL7RLzN29pA3znhArXMXwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058