UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AuGKXZR0P2WyRZQ/l7pzdHpL9se+FU/YJrYRjo6Tjj4=' 
WHERE 
  key_id = '7e213b8c248ec8794fd0b0ae5e543051cbf1575981ea9b04c3b3004197757af7' 
  AND (
    token = 'AuGKXZR0P2WyRZQ/l7pzdHpL9se+FU/YJrYRjo6Tjj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042