UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7hy9gYO8ocbO/L22NA/KzL+dDO0vOEbIHdjcXY351xw=' 
WHERE 
  key_id = 'eb5749c748c8d4d59f01c74921f9adc59926720be3bf46bf9dbae31575bf3767' 
  AND (
    token = '7hy9gYO8ocbO/L22NA/KzL+dDO0vOEbIHdjcXY351xw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035