UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IJTv0diOLgw2InbC6ZBJBLgrqqK943LdTgyIecpMIv8=' 
WHERE 
  key_id = '48352ffe3fe84bbb5de572f0efe8a0668fb272081467326096e84d79337faaeb' 
  AND (
    token = 'IJTv0diOLgw2InbC6ZBJBLgrqqK943LdTgyIecpMIv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032