UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sASoeA9ET+KqSqMByfYlPyt+5Y+IFR5EI2ZCKrX7/xI=' 
WHERE 
  key_id = '13a0bb994d1a9d374021f69dfc624e756b0d74e41965664cb133886c538f3f00' 
  AND (
    token = 'sASoeA9ET+KqSqMByfYlPyt+5Y+IFR5EI2ZCKrX7/xI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046