UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FGSXp11s99VxK7PIST7Db57cJOlPLoPEn4HeoUsdpcA=' 
WHERE 
  key_id = '72d84494f6ec383626f7b531d9640f2a1e3d1f3a6857ee29e712ee90f265c310' 
  AND (
    token = 'FGSXp11s99VxK7PIST7Db57cJOlPLoPEn4HeoUsdpcA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036