UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CBEYBpJzfgy475nb31SW8XhCaKHrthTfl3CACWgLqx4=' 
WHERE 
  key_id = 'ee5a619fdfaf3d6cc8616c588fe2998cfb2c7a42b98a6494bb17f4de5d8e876a' 
  AND (
    token = 'CBEYBpJzfgy475nb31SW8XhCaKHrthTfl3CACWgLqx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050