UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kM0Su0O0TwMvlbOYL16rzfQvftr5WaVs8ep+ZBXNUXg=' 
WHERE 
  key_id = '901d1aaf0ff56b64bd9fa871e569fb3b88356b4f9b2c7c072b112369472d8d10' 
  AND (
    token = 'kM0Su0O0TwMvlbOYL16rzfQvftr5WaVs8ep+ZBXNUXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034