UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zOZ6SW85RjK1+BJTQ0HWpHPtWNHR6+d2M0z/4LysTIs=' 
WHERE 
  key_id = 'deb4d6ad5c010f21952883fad04c62bb87836d1f222dccbdd2ebd06de39764a1' 
  AND (
    token = 'zOZ6SW85RjK1+BJTQ0HWpHPtWNHR6+d2M0z/4LysTIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024