UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a9hn8PcVyjCF3hAJF0aW09c/paGG7bfoODqwBbk6n+8=' 
WHERE 
  key_id = '4b8c947b8dcd4e8311fe68db13152ea679f019cbce5ea14f154cd87a1fa7d0c3' 
  AND (
    token = 'a9hn8PcVyjCF3hAJF0aW09c/paGG7bfoODqwBbk6n+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041