UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wE/6DVNKUxuzYkoyLtqEz1mvyl+7x/1kUxudgq97vYw=' 
WHERE 
  key_id = 'c1b9ef5440258c73c2f79d1726b9171c5a205bf302564e2b7ed8e27cca06e7e3' 
  AND (
    token = 'wE/6DVNKUxuzYkoyLtqEz1mvyl+7x/1kUxudgq97vYw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035