UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sup81tcgLwFH79qoat0Cm3dG6LjleyHBZl0TL5CZlOI=' 
WHERE 
  key_id = '656f6465a672a4e38c022b72b3a5678c2632ec03ea54e79790b1fde4a8df848a' 
  AND (
    token = 'sup81tcgLwFH79qoat0Cm3dG6LjleyHBZl0TL5CZlOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030