UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XI+/2H5ZEE4AbEjVZ3UXY+tXaQ4vK7A8JI8+bhpxO8A=' 
WHERE 
  key_id = 'b9ca521df88d7a1e9e14692db086dceed3ab18a9fe44bfccc8e34b45f7e54c13' 
  AND (
    token = 'XI+/2H5ZEE4AbEjVZ3UXY+tXaQ4vK7A8JI8+bhpxO8A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044