UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LpA+cC8wh7TDKrEz6/siQ8RBMbtneEBy8nf1ZVXH56w=' 
WHERE 
  key_id = '3bb329c64b4bb0daf06c4839af6f1deda2b1f94e78fe244ff9e7791851b6ae20' 
  AND (
    token = 'LpA+cC8wh7TDKrEz6/siQ8RBMbtneEBy8nf1ZVXH56w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00192