UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aov+Oe1urPuxiCNxe03OQoM4pakXY/5K/3wderArwjs=' 
WHERE 
  key_id = 'd1b4ecd458bf9a75a15f1194c8b14b58abd56aea62eed2625cc21d7da7cd084c' 
  AND (
    token = 'aov+Oe1urPuxiCNxe03OQoM4pakXY/5K/3wderArwjs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036