UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'urLtEKvm2i7HSq7vhcYYoOO95uDthC+Ikg9kDmv5+jo=' 
WHERE 
  key_id = '58f4a4b3201199037ad56df88af53665da58452eedb4592151c433ee29eaf5fd' 
  AND (
    token = 'urLtEKvm2i7HSq7vhcYYoOO95uDthC+Ikg9kDmv5+jo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023