UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ly5OqwHzwLBaj4X42C+vXnOkrokHmWceLDdc/CBDctE=' 
WHERE 
  key_id = '02408c347e47b37eef91bbd377a5173b98d3dfb4a82e7399afd9a0e634933179' 
  AND (
    token = 'Ly5OqwHzwLBaj4X42C+vXnOkrokHmWceLDdc/CBDctE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030