UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jKsIKejzdH3cOGIDord+Gl7ri3N6W5ZSh/oz6Rfxjm8=' 
WHERE 
  key_id = '0279b3b4fd3410111370d63d8799632b235cbb262237709b2e0a5dfd2e46e81d' 
  AND (
    token = 'jKsIKejzdH3cOGIDord+Gl7ri3N6W5ZSh/oz6Rfxjm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034