UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm39u5h/xCPSQrQmMMm5VVwmOInTMesyqwY/UHUBZntE=' 
WHERE 
  key_id = '4c4063314426cb5b4c9016f2b2b7788cf50485959f98a835f94c1d3f82ae287d' 
  AND (
    token = 'm39u5h/xCPSQrQmMMm5VVwmOInTMesyqwY/UHUBZntE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032