UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yj4cZyVEhtuRstXgUC3qQNuH0elz5seK6W8sonEPTAs=' 
WHERE 
  key_id = 'efac54db75c4f68c76231a857df0b1bbbd22221cba3a2801aeba1b4f455ed460' 
  AND (
    token = 'yj4cZyVEhtuRstXgUC3qQNuH0elz5seK6W8sonEPTAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030