UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cKIV2TAy88Q8JvkQLFiPnANM5/Rhz08fw7aT4ZJaN8c=' 
WHERE 
  key_id = '5252e81907a5c36a8a08beae788e81d9ddedb27080553359e9b4eae31ec97376' 
  AND (
    token = 'cKIV2TAy88Q8JvkQLFiPnANM5/Rhz08fw7aT4ZJaN8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028