UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EhFrPBEPwerKqE1si+LwjZlvPXGJrgD+qTpW0oKGtFg=' 
WHERE 
  key_id = '5b3113f4a17692904a9e2a479ebe0045d1be765ff980dd14d40d6474735314c7' 
  AND (
    token = 'EhFrPBEPwerKqE1si+LwjZlvPXGJrgD+qTpW0oKGtFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033