UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6S+ymwDUyNA1b/UuveezkWR+6ynHTwD6TiIsr7SphIE=' 
WHERE 
  key_id = '168640ed954dbaecc0858364313c2e716cf09b428cc8a182282d695f1d406b40' 
  AND (
    token = '6S+ymwDUyNA1b/UuveezkWR+6ynHTwD6TiIsr7SphIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034