UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ca9BRjhfd5Ady+W/6B07pzy+yL9LxBdf3X29Mgyx6v4=' 
WHERE 
  key_id = '312aefffbdbc3550cde3ed03a3ec28f007f176c1941103dc5b944744a486653e' 
  AND (
    token = 'ca9BRjhfd5Ady+W/6B07pzy+yL9LxBdf3X29Mgyx6v4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027