UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'khE/7rRzlXxPZYovOUb6EukHq7eZn9q/x5piB2mT7/Y=' 
WHERE 
  key_id = 'bf8963b5f35bb9cc789ea1aba15c286ca3b0058bd9df7f0e2119b29dcd8587cb' 
  AND (
    token = 'khE/7rRzlXxPZYovOUb6EukHq7eZn9q/x5piB2mT7/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037